home *** CD-ROM | disk | FTP | other *** search
/ The Game Master (3rd Edition) / The Game Master 3rd edition.iso / files / demo_vga / utilega1 / ega.doc < prev    next >
Encoding:
Text File  |  1986-03-05  |  52.4 KB  |  1,655 lines

  1.  
  2.                                                         DATE:   02/25/86
  3.                                                         SYSTEM: KC-TPEGA
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.               Graphics for the IBM's Enhance Graphic Adapter (EGA)
  20.  
  21.  
  22.                               Version 02/25/86
  23.  
  24.  
  25.                            for Microsoft C 3.00+
  26.  
  27.                                    and
  28.  
  29.                             Turbo Pascal 3.01A+
  30.  
  31.  
  32.                                                         DATE:   02/03/86
  33.                                                         SYSTEM: KC-TPEGA
  34.  
  35.  
  36.  
  37.                                  IMPORTANT NOTICE
  38.  
  39.  
  40.         The Enhanced Graphic Adapter (EGA) graphic routines for Microsoft
  41.         3.0 and Turbo Pascal 3.01A was written and is maintained by:
  42.  
  43.                                Kent Cedola
  44.                                2015 Meadow Lake Court
  45.                                Norfolk, Virginia  23518
  46.                                1-(804)-857-0613
  47.  
  48.         Users of this software are encouraged to copy and distribute the
  49.         graphics library and demonstrations programs which are a part of
  50.         this package for non-commericial purposes.
  51.  
  52.         No fee or other charges may be made in the distribution of these
  53.         programs without the written permission from Kent Cedola.
  54.  
  55.         Any program written with this graphic library may be sold, as
  56.         long as the source code for the graphic library in not included.
  57.         If you wish to include the graphic library with the product,
  58.         please contact me for more information and written permission.
  59.  
  60.         The date of release will be used in instead of a version.  When
  61.         requesting information, please included the date (version) of the
  62.         copy that you have and the amount of EGA memory.  Write the above
  63.         for the current release of the graphic library.
  64.  
  65.         If you are satified with the EGA support for Turbo Pascal you are
  66.         asked to send a donation of $20.00 dollars.  All registered users
  67.         will be informed of any major improvements and/or programs
  68.         developments.
  69.  
  70.                                 FREE COPY OF TPEGA
  71.  
  72.         If you send a diskette with a SASE, I will send you the current
  73.         copy of the library and programs for FREE! (360k or 1.2meg disk)
  74.  
  75.  
  76.                                                         DATE:   02/03/86
  77.                                                         SYSTEM: KC-TPEGA
  78.  
  79.  
  80.  
  81.                                       GENERAL
  82.  
  83.  
  84.         This graphic software was written to provide the general public
  85.         a means for writing graphic program for the EGA without any run-
  86.         time fee!  The software is also design to give the programmer
  87.         the most flexibility, so most graphic routines can be changed or
  88.         deleted (saving space) from the final product.
  89.  
  90.  
  91.         If you have some application that required some special high-speed
  92.         graphic routine, let me know and I'll see what I can do.  But most
  93.         routines that are not provided can be built around the standard
  94.         graphic primitives. Graphic primitives (any routine with a prefix
  95.         of GP) are low level graphic routine that are (mostly) supported
  96.         over various graphic adapters (in the future).
  97.  
  98.  
  99.         Those with the standard EGA (only 64k of memory) may have some
  100.         problems with some of the graphic primitives as I have a 128k+
  101.         EGA.  I highly recommend adding extra memory to your EGA if
  102.         you plan to do alot of graphic programming.
  103.  
  104.  
  105.             The future for EGA graphic library                 Release
  106.  
  107.                1.  Support Microsoft's mouse.                   APR86
  108.                2.  Support for AT&T's ICB (digitizer).          APR86
  109.                3.  Support image processing routines            APR86
  110.                4.  Support virtual workspace & workareas        APR86
  111.                5.  Support 320x200x16 mode
  112.                6.  Support high-speed sprite routines.
  113.                7.  Support graphic segments to build objects.
  114.                8.  Support 3D graphic and CAD routines.
  115.                9.  Support for PC-EYE from Chorus Data Systems.
  116.               10.  Support for AT&T's VDA.
  117.  
  118.  
  119.             The APR86 release will be for C only!
  120.  
  121.  
  122.  
  123.  
  124.                                                         DATE:   02/03/86
  125.                                                         SYSTEM: KC-TPEGA
  126.  
  127.  
  128.                            Questions & Answers
  129.  
  130.  
  131.         Q.  Do you maintain the current version of your graphic library
  132.             on a BBS?  If so, which one.
  133.         A.  Yes, the PC-CONNECTION (804) 481-1824, will always contain
  134.             the current version of ALL of my EGA software.  But user
  135.             validation is required (+money, 10 or 20 a year).  The BBS
  136.             contains two nodes and 60megs online.  Any disk with SASE
  137.             sent to me will be return with ALL my EGA software (FREE).
  138.  
  139.         Q.  Where is the assembler source code?
  140.         A.  I am holding assembler source code to try to maintain an
  141.             EGA graphic standard and to make it easier to change it
  142.             without effecting others with 'old' assembler code.  Very
  143.             little of the code is for the EGA, most is just standard
  144.             graphic code that could be used with any graphic adapter.
  145.             I will release all source code sometime in the future. I
  146.             don't know when.
  147.  
  148.         Q.  Do you know that some of your comments do not match the
  149.             code below it? (from Steve)
  150.         A.  Yes, the documentation manual will always contain the
  151.             correct information.  Don't worry about the headers.
  152.             I'm mostly worried about the code working.
  153.  
  154.         Q.  Will you re-code your routines for other graphic adapters
  155.             to form a public domain standard for graphic primitives?
  156.         A.  Yes, I am currently re-coding for the AT&T's Image Capture
  157.             Board (ICB) and adding image processing routines.
  158.  
  159.         Q.  How about BASIC support?
  160.         A.  Buy Turbo Pascal or Microsoft C 3.0+.
  161.             (C is better for writing large graphic programs).
  162.  
  163.  
  164.                                                         DATE:   02/03/86
  165.                                                         SYSTEM: KC-TPEGA
  166.  
  167.  
  168.                                 SPECIAL NOTICE
  169.  
  170.  
  171.         While trying to get as many graphic routines as possible in this
  172.         release I had to cut corners on the GPSHADE, GPFILL and GPFLOOD
  173.         graphic primitives.  The GPFILL should be used for simple objects
  174.         to be filled in and GPFLOOD for complex objects. Currently, GPFILL
  175.         calls GPFLOOD to do the fill, this will change in the future as I
  176.         will write a version of GPFILL that will execute two or three times
  177.         faster than GPFLOOD (GPFILL = Simple objects only).  GPSHADING has
  178.         a restriction for dimensions of 1,2,4 or 8 or both width and height.
  179.         Other dimensions can be used, but funny fills may happen (will be
  180.         fixed later).  The GPFLOOD routine is fast, and will fill in any
  181.         area no matter how complex (more complex more stack space), but I
  182.         will re-write it for higher speeds.
  183.  
  184.         Both the GPBOX and GPBALL primitives only do solid colors and not
  185.         shades.  Both use special EGA full byte fill modes and are fast.
  186.         BPBOX and GPBALL do NOT set the clipping flag. (Later)
  187.  
  188.         These primitives do work, but they can be better.  I will improve
  189.         the flexibility and speed of these routines in the future.
  190.  
  191.         The following routines miss this release (are in the documentation)
  192.         will be included in a future release.
  193.  
  194.                         GPSCROLL
  195.                         GPPOLY
  196.  
  197.  
  198.                                                         DATE:   02/03/86
  199.                                                         SYSTEM: KC-TPEGA
  200.  
  201.  
  202.                          SPECIAL NOTICE TO C USERS
  203.  
  204.  
  205.         So much code, so little time to write it!  All of the Turbo Pascal
  206.         routines have been converted to Microsoft C and mostly tested (see
  207.         programs kc_pal.c, demo.c and popup.c).  Please examine the source
  208.         code!  It does contain information that is not in the documentation
  209.         (e.g., gotoxy, gprintf, gpmovgtm and gpmovgtm).
  210.  
  211.         The C release is not as clean as I would like because of the BIG
  212.         improvements in the 01APR86 release (C only!).  And I did not want
  213.         to hold the graphic library until then because most graphic routines
  214.         will not change.  The the 01APR86 release will contain the concept
  215.         of virtual workspaces (memory array) and real workareas (graphic
  216.         display).  I need it for Image Processing Software that I am coding
  217.         in C, but will be very powerful to most other programmers.  For
  218.         example:
  219.  
  220.                 1. Automatic swapping of workspaces when not being used.
  221.                    (workspaces contain fonts, icons, parts of the screen)
  222.  
  223.                 2. Each pixel in a workspace may be 1,2,4,8 or 16 bits.
  224.                    (defined when workspace created).
  225.  
  226.                 3. Automatic clipping of images to/from display.
  227.  
  228.                 4. Automatic zooming/shrinking (if requested) when moving
  229.                    images (or letter and icons) to/from display.
  230.  
  231.                 5. Windowing of a workspace in a workarea? (MAYBE)
  232.  
  233.  
  234.                                                         DATE:   02/03/86
  235.                                                         SYSTEM: KC-TPEGA
  236.  
  237.  
  238.                         List of Graphic Functions
  239.  
  240.  
  241.          Graphics Routines               Description
  242.         ----------------------------    ---------------------------------
  243.          GPPARMS;                        Setup graphic adapter parameters
  244.          GPINIT;                         Initialize graphic display
  245.          GPTERM;                         Terminate graphic display
  246.  
  247.          GPCOLOR(b);                     Set current color
  248.          GPMERGE(b);                     Set current merge mode
  249.          GPSTYLE(array);                 Set pattern for drawing lines
  250.          GPSHADE(array);                 Set pattern for shading areas
  251.          GPRDCLR;                        Return the current color
  252.  
  253.          GPPAL(p,v);                     Set a palette register
  254.          GPCPAL(p,v);                    Set a palette register using RGB
  255.          GPLDPAL(array);                 Load all palette registers
  256.          GPRDPAL(p);                     Read current palette setting
  257.  
  258.          GPPLOT(X,Y);                    Plot a point at X,Y (sets new CP)
  259.          GPRDDOT(X,Y)                    Read pixel at coordinates (X,Y)
  260.          GPMOVE(X,Y);                    Set current graphic position (CP)
  261.          GPLINE(X,Y);                    Draw a line from (CP) to X,Y
  262.          GPPOLY(array,N);                Draw a N number of lines
  263.          GPRECT(X,Y);                    Draw a rectangle between CP and (X,Y)
  264.          GPCIR(R);                       Draw a circle at CP with R radius
  265.  
  266.          GPWTROW(Array,N);               Write a row of pixels
  267.          GPWTCOL(Array,N);               Write a column of pixels
  268.          GPRDROW(Array,N);               Read a row of pixels
  269.          GPRDCOL(Array,N);               Read a column of pixels
  270.  
  271.          GPBOX(X,Y);                     Draws a solid box with color/shading
  272.          GPBAL(R);                       Draws a solid circle with color/shading
  273.  
  274.          GPSCROLL(Dir,I,N);              Scroll current viewport
  275.  
  276.          GPVIEWPORT(X1,Y1,X2,Y2);        Set current viewport
  277.          GPWINDOW(X1,Y1,X2,Y2);          Set current window
  278.          GPCLIP1(X,Y);                   Clip point in current window
  279.          GPCLIP2(X1,Y1,X2,Y2);           Clip line in current window
  280.          GPSCALE(X,Y);                   Scale from world to device
  281.  
  282.          GPFILL(Border);                 Simple object fill, color/shading
  283.          GPFLOOD(Border);                Complex object fill, color/shading
  284.  
  285.  
  286.                                                         DATE:   02/03/86
  287.                                                         SYSTEM: KC-TPEGA
  288.  
  289.  
  290.                         List of Global Variables
  291.  
  292.  
  293.          Global Variable                 Description
  294.         ----------------------------    ---------------------------------
  295.          GDTYPE:        Integer;         3 = CG, 4 = Mono, 5 = Color
  296.          GDOTHER:                        Internal Use Only
  297.          GDMEMORY:      Integer;         Amount of memory, 64 -> 256
  298.          GDMAXCOL:      Integer;         Maximum column (639 for EGA)
  299.          GDMAXROW:      Integer;         Maximum row (199/349 for EGA)
  300.          GDMAXPAL:      Integer;         Maximum palettes (4/16 for EGA)
  301.          GDMAXCLR:      Integer;         Maximum colors (63 for EGA)
  302.  
  303.          GDCOLOR:       Integer;         Current color for drawing
  304.          GDMERGE:                        Internal Use Only
  305.          GDSTYLE:                        Internal Use Only
  306.          GDSHADE:                        Internal Use Only
  307.          GDSHADE1:                       Internal Use Only
  308.          GDASPC1:       Integer;         Aspect for circles (3 for EGA)
  309.          GDASPC2:       Integer;         Aspect for circles (4 for EGA)
  310.          GDCUR_X:       Integer;         Current X coordinate
  311.          GDCUR_Y:       Integer;         Current Y coordinate
  312.  
  313.          GDGSEG:                         Internal Use Only
  314.          GDGSADR:                        Internal Use Only
  315.  
  316.          GDWD_X1:       Integer;         Window coordinate (low)
  317.          GDWD_X2:       Integer;         Window coordinate (high)
  318.          GDWD_X3:       Integer;         Window coordinate (delta+1)
  319.          GDWD_Y1:       Integer;         Window coordinate (low)
  320.          GDWD_Y2:       Integer;         Window coordinate (high)
  321.          GDWD_Y3:       Integer;         Window coordinate (delta+1)
  322.  
  323.          GDVW_X1:       Integer;         Viewport coordinate (low)
  324.          GDVW_X2:       Integer;         Viewport coordinate (high)
  325.          GDVW_X3:       Integer;         Viewport coordinate (delta+1)
  326.          GDVW_Y1:       Integer;         Viewport coordinate (low)
  327.          GDVW_Y2:       Integer;         Viewport coordinate (high)
  328.          GDVW_Y3:       Integer;         Viewport coordinate (delta+1)
  329.  
  330.          GDC_FLG:       Integer;         Last plot clipping status
  331.          GDS_FLG:       Integer;         Color/Shade or Color/Style flag
  332.          GDW_FLG:       Integer;         Enable/Disable World coordinates
  333.  
  334.          GDCURX1:       Integer;         World current X coordinate
  335.          GDCURY1:       Integer;         World current Y coordinate
  336.  
  337.  
  338.                                                         DATE:   02/03/86
  339.                                                         SYSTEM: KC-TPEGA
  340.  
  341.  
  342.  
  343.         NAME:
  344.  
  345.                 GPPARMS -- Setup current graphic adapter parameters
  346.  
  347.         SYNOPSIS:
  348.  
  349.                 P: procedure GPPARMS;
  350.  
  351.                 C: void GPPARMS();
  352.  
  353.         DESCRIPTION:
  354.  
  355.                 This procedure will initialize various global variables
  356.             on the status of the current graphic adapter.  If only needs
  357.             to be executed once in the life of a program.
  358.  
  359.         RETURNS:
  360.  
  361.             GDTYPE = 0, no ega, monochrome adapter (text mode) { maybe }
  362.                    = 1, no ega, old color graphic adapter (CG) { maybe }
  363.                    = 2, EGA with old color graphic monitor (320x200x16)
  364.                    = 3, EGA with old color graphic monitor (640x200x16)
  365.                    = 4, EGA with monochrome monitor (640x350x4)
  366.                    = 5, EGA with new Enhanced Color Display (640x350x16)
  367.                    = 6, ?
  368.  
  369.         CAUTIONS:
  370.  
  371.             This procedure MUST be performed before any other primitive.
  372.                            ----
  373.         EXAMPLE:
  374.  
  375.             P: GPPARMS;                    { Determine the type of Adapter }
  376.  
  377.                if GDTYPE <> 4 and GDTYPE <> 5 then   { 4 = mono, 5 = color }
  378.                  begin
  379.                  writeln('Must have IBM Enhanced Graphic Display!');
  380.                  halt(1);
  381.                  end;
  382.  
  383.             C: GPPARMS();
  384.  
  385.                if (GDTYPE != 5)
  386.                  {
  387.                  fprintf(stderr,'Must have EGA color display!\n');
  388.                  exit(1);
  389.                  };
  390.  
  391.  
  392.                                                         DATE:   02/03/86
  393.                                                         SYSTEM: KC-TPEGA
  394.  
  395.  
  396.  
  397.         NAME:
  398.  
  399.                 GPINIT -- Initialize the Enhanced Graphic Adapter
  400.  
  401.         SYNOPSIS:
  402.  
  403.                 P: PROCEDURE GPINIT;
  404.  
  405.                 C: GPINIT();
  406.  
  407.         DESCRIPTION:
  408.  
  409.                 This procedure will place the EGA in color or mono
  410.             graphic mode depending on hardware connected to the EGA.
  411.             This routine can be repeated to reset graphic state. If
  412.             you are using the standard color monitor with the EGA,
  413.             will setup in 640x200 (16 colors) mode, else 640x350.
  414.  
  415.         CAUTIONS:
  416.  
  417.                 The procedure 'GPPARMS' must be used to determine if
  418.             an EGA is available. The EGA must be placed in graphic mode
  419.             before executing the other graphic routines (not including
  420.             'GPPARMS').
  421.  
  422.         EXAMPLE:
  423.  
  424.             P: GPPARMS;                 { Determine the type of Adapter }
  425.  
  426.                if GDTYPE <> 4 and GDTYPE <> 5 then
  427.                  begin
  428.                  write('Must have IBM Enhanced Graphic Display!');
  429.                  halt;
  430.                  end
  431.                else
  432.                  begin
  433.                  GPInit;                 { Initialize the EGA           }
  434.                  end;
  435.  
  436.             C: GPPARMS();
  437.  
  438.                if (GDTYPE != 4)
  439.                  {
  440.                  fprintf(stderr,'Must have EGA monochrome display!\n');
  441.                  exit(1);
  442.                  }
  443.                else
  444.                  {
  445.                  GPINIT();
  446.                  };
  447.  
  448.         SEE ALSO:
  449.  
  450.             GPPARMS and GPTERM.
  451.  
  452.  
  453.                                                         DATE:   02/03/86
  454.                                                         SYSTEM: KC-TPEGA
  455.  
  456.  
  457.  
  458.         NAME:
  459.  
  460.                 GPTERM -- Terminate graphic mode and return to text
  461.  
  462.         SYNOPSIS:
  463.  
  464.                 P: procedure GPTERM;
  465.  
  466.                 C: void GPTERM;
  467.  
  468.         DESCRIPTION:
  469.  
  470.                 This procedure will return the EGA back to text mode.
  471.                 Mode 3 for color EGA and mode 7 for monochrome monitors.
  472.  
  473.         CAUTIONS:
  474.  
  475.                 Should not be performed on a non EGA computer.
  476.  
  477.         EXAMPLES:
  478.  
  479.             P: GPTERM;
  480.  
  481.             C: GPTERM();
  482.  
  483.         SEE ALSO:
  484.  
  485.             GPPARMS and GPINIT.
  486.  
  487.  
  488.                                                         DATE:   02/03/86
  489.                                                         SYSTEM: KC-TPEGA
  490.  
  491.  
  492.  
  493.         NAME:
  494.  
  495.                 GPCOLOR -- Set the current color
  496.  
  497.         SYNOPSIS:
  498.  
  499.                 P: procedure GPCOLOR(Value: Integer);
  500.  
  501.                 C: void GPCOLOR(Value)
  502.                      int Value;
  503.  
  504.         DESCRIPTION:
  505.  
  506.                 Set the color to be used by the other ploting routines
  507.             (GPPLOT, GPLINE, GPRECT, etc...).  The primitive GPRDCLR can
  508.             can be used to read the current color. The global GDMAXPAL will
  509.             contain the highest color value allowed.   Setting the color
  510.             will set the style/shading flag to zero, this will cause all
  511.             drawing and filling primitives to use the current color and
  512.             not the current style/shading.  Use the Turbo Pascal function
  513.             TEXTCOLOR for text coloring.
  514.  
  515.         EXAMPLE:
  516.  
  517.             P: GPCOLOR(Green);             { Set color to Green     }
  518.                GPMOVE(50,50);              { Draw a green rectangle }
  519.                GPRECT(100,100);
  520.  
  521.             C: color = GPRDCLR;            /* Save the current color */
  522.  
  523.                GPCOLOR(Red);               /* Define a new color     */
  524.  
  525.                GPMOVE(X1,Y1);              /* Draw a red line        */
  526.                GPLINE(X2,Y2);
  527.  
  528.                GPCOLOR(color);             /* Restore color          */
  529.  
  530.         SEE ALSO:
  531.  
  532.             GPRDCLR, GPSTYLE, GPSHADE.
  533.  
  534.  
  535.                                                         DATE:   02/03/86
  536.                                                         SYSTEM: KC-TPEGA
  537.  
  538.  
  539.  
  540.         NAME:
  541.  
  542.                 GPMERGE -- Set the placement of graphic data
  543.  
  544.         SYNOPSIS:
  545.  
  546.                 P: procedure GPMERGE(Value: Integer);
  547.  
  548.                 C: void GPMERGE(Value)
  549.                      int Value;
  550.  
  551.                                Merge modes, 0 - Store (default)
  552.                                             1 - AND
  553.                                             2 - OR
  554.                                             3 - XOR
  555.  
  556.         DESCRIPTION:
  557.  
  558.                 Specify the method which data is placed in the graphic
  559.             memory.  The various merge modes are performed with hardware
  560.             on the EGA.  Almost all graphic routines will be effected by
  561.             setting the merge value, but not all.
  562.  
  563.         CAUTIONS:
  564.  
  565.                 Setting non-zero merge mode can slow down some graphic
  566.            primitives. (e.g., GPFLOOD).
  567.  
  568.         EXAMPLE:
  569.  
  570.             P: GPMERGE(3);                    { Set merge mode to XOR }
  571.                GPCOLOR(Green);                { Set color to Green    }
  572.                GPMOVE(50,50);                 { XOR green box         }
  573.                GPBOX(100,100);
  574.                GPMERGE(0);                    { Return merge mode to default }
  575.  
  576.         SEE ALSO:
  577.  
  578.             GPFILL and GPFLOOD.
  579.  
  580.  
  581.                                                         DATE:   02/03/86
  582.                                                         SYSTEM: KC-TPEGA
  583.  
  584.  
  585.  
  586.         NAME:
  587.  
  588.                 GPSTYLE -- Set the current line style
  589.  
  590.         SYNOPSIS:
  591.  
  592.                 P: procedure GPSTYLE(var Style);
  593.  
  594.                 C: void GPSTYLE(Style)
  595.                      unsigned char Style[];
  596.  
  597.         DESCRIPTION:
  598.  
  599.                 Set the line style for the line drawing primitives.  The
  600.             parameter is an array of color bytes with the first byte con-
  601.             taining the length.  The style/shading flag will be set to
  602.             non-zero to flag the line routines to use the current line style
  603.             and not the current color setting.
  604.  
  605.         EXAMPLE:
  606.  
  607.             C: unsigned char Style[] =     /* Set line style to GGBB  */
  608.                  {4,Green,Green,Blue,Blue};
  609.  
  610.                GPSTYLE(Style);             /* Define the line style   */
  611.  
  612.                GPMOVE(X1,Y1);
  613.                GPLINE(X2,Y2);              /* Draw line using style   */
  614.  
  615.                GPCOLOR(color);             /* Set color               */
  616.  
  617.                GPLINE(X3,Y3);              /* Draw green line         */
  618.  
  619.                GPS_FLG := -1;              /* Goback to style setting */
  620.  
  621.                GPLINE(X4,Y4);              /* Draw line using style   */
  622.  
  623.         SEE ALSO:
  624.  
  625.             GPCOLOR.
  626.  
  627.  
  628.                                                         DATE:   02/03/86
  629.                                                         SYSTEM: KC-TPEGA
  630.  
  631.  
  632.  
  633.         NAME:
  634.  
  635.                 GPSHADE -- Set the current fill/flood shading
  636.  
  637.         SYNOPSIS:
  638.  
  639.                 P: procedure GPSHADE(var Style);
  640.  
  641.                 C: void GPSHADE(Style)
  642.                      unsigned char Style[];
  643.  
  644.         DESCRIPTION:
  645.  
  646.                 Set the shading matrix for fill/flooding primitives.  The
  647.             parameter is an array of color bytes with the first byte con-
  648.             taining the width and the second containing the height.  The
  649.             style/shading flag (GDS_FLG) will be set to a non-zero value.
  650.  
  651.         CAUTIONS:
  652.  
  653.             Although any dimension from 1 to 255 can be used, the current
  654.             version of GPFILL and GPFLOOD only works correctly with shade
  655.             of dimensions of 1,2,4 or 8 (x and y can be different).  This
  656.             restriction will be removed in the future.
  657.  
  658.         EXAMPLE:
  659.  
  660.             C: unsigned char Shade[] =     /* Set fill shade to GBGB  */
  661.                  {2,2,Green,Blue,Blue,Green};    /* 2 by 2 array */
  662.  
  663.                GPSHADE(Shade);             /* Define the shading      */
  664.  
  665.                GPMOVE(X1,Y1);
  666.                GPFLOOD(color);             /* Flood area with border
  667.                                               defined by color        */
  668.  
  669.         SEE ALSO:
  670.  
  671.             GPCOLOR, GPSTYLE, GPFILL and GPFLOOD.
  672.  
  673.  
  674.                                                         DATE:   02/03/86
  675.                                                         SYSTEM: KC-TPEGA
  676.  
  677.  
  678.  
  679.         NAME:
  680.  
  681.                 GPRDCLR -- Read the current color
  682.  
  683.         SYNOPSIS:
  684.  
  685.                 P: function GPRDCLR: Integer;
  686.  
  687.                 C: int GPRDCLR();
  688.  
  689.         DESCRIPTION:
  690.  
  691.                 Return the current color setting.  Use to save the current
  692.             color setting.
  693.  
  694.         RETURN:
  695.  
  696.                 The current color setting.
  697.  
  698.         EXAMPLE:
  699.  
  700.             C: color = GPRDCLR;            /* Save the current color */
  701.  
  702.                GPCOLOR(Red);               /* Define a red line      */
  703.  
  704.                GPMOVE(X1,Y1);
  705.                GPLINE(X2,Y2);              /* Draw a red line        */
  706.  
  707.                GPCOLOR(color);             /* Restore color          */
  708.  
  709.         SEE ALSO:
  710.  
  711.             GPCOLOR.
  712.  
  713.  
  714.                                                         DATE:   02/03/86
  715.                                                         SYSTEM: KC-TPEGA
  716.  
  717.  
  718.  
  719.         NAME:
  720.  
  721.                 GPPAL -- Set a palette register
  722.  
  723.         SYNOPSIS:
  724.  
  725.                 P: procedure GPPAL(Palette, Color: Integer);
  726.  
  727.                 C: void GPPAL(Palette, Color)
  728.                      int Palette, Color;
  729.  
  730.         DESCRIPTION:
  731.  
  732.                 Set a palette to a given color value.  The maximum range
  733.             of the palette variable is contained in GDMAXPAL. The max
  734.             range of the color variable in contained in GDMAXCLR. These
  735.             two global variables are set by the routine 'GPPARMS'.   If
  736.             -1 is the palette value then the border is set to the given
  737.             color.
  738.  
  739.         CAUTIONS:
  740.  
  741.                 Setting the border color is not recommended for the EGA.
  742.  
  743.         EXAMPLE:
  744.  
  745.             P: GPPAL(5,20);                { Set palette 5 to color 20  }
  746.  
  747.         SEE ALSO:
  748.  
  749.             GPCPAL and GPRDPAL.
  750.  
  751.                                                         DATE:   02/03/86
  752.                                                         SYSTEM: KC-TPEGA
  753.  
  754.  
  755.  
  756.         NAME:
  757.  
  758.                 GPCPAL -- Set a palette register using R,G,B
  759.  
  760.         SYNOPSIS:
  761.  
  762.                 P: procedure GPCPAL(Palette, R, G, B: Integer);
  763.  
  764.                 C: void GPCPAL(Palette, R, G, B)
  765.                      int Palette, R, G, B;
  766.  
  767.         DESCRIPTION:
  768.  
  769.                 Set a palette to a given color using the RGB values.
  770.             The max value of each primary color can be determine by the
  771.             (cube root of (GDMAXCLR+1) - 1).  If -1 is the palette value
  772.             then the border is set to the given color.
  773.  
  774.         CAUTIONS:
  775.  
  776.                 Setting the border color is not recommended for the EGA.
  777.  
  778.         EXAMPLE:
  779.  
  780.             P: GPCPAL(5,2,1,0);            { Set palette 5 to RGB(2,1,0)}
  781.  
  782.         SEE ALSO:
  783.  
  784.             GPPAL and GPRDPAL.
  785.  
  786.                                                         DATE:   02/03/86
  787.                                                         SYSTEM: KC-TPEGA
  788.  
  789.  
  790.  
  791.         NAME:
  792.  
  793.                 GPLDPAL -- Set all the palette registers
  794.  
  795.         SYNOPSIS:
  796.  
  797.                 P: procedure GPLDPAL(var Palettes : Bytes);
  798.  
  799.                 P: void GPLDPAL(Palettes)
  800.                      unsigned char Palettes[];
  801.  
  802.         DESCRIPTION:
  803.  
  804.                 Load all the palette registers from a given array.  The
  805.             number of palettes can be determine by GDMAXPAL + 2.  The
  806.             border color is located in GDMAXPAL + 2.
  807.  
  808.         CAUTIONS:
  809.  
  810.                 Setting the border color is not recommended for the EGA.
  811.  
  812.         EXAMPLE:
  813.  
  814.             P: pals: array [0..16] of byte; { pals[0] > pals[15] colors }
  815.                                             { pals[16] border color     }
  816.  
  817.                for i := 0 to 15 do          { Reset to default colors   }
  818.                  begin
  819.                  if i < 8 then
  820.                    pals[i] := i
  821.                  else
  822.                    pals[i] := 48 + i;
  823.  
  824.                pals[16] := 0;               { Keep border Black         }
  825.  
  826.                GPLDPAL(pals);               { Set palettes and border   }
  827.  
  828.  
  829.                                                         DATE:   02/03/86
  830.                                                         SYSTEM: KC-TPEGA
  831.  
  832.  
  833.  
  834.         NAME:
  835.  
  836.                 GPRDPAL -- Set a palette register
  837.  
  838.         SYNOPSIS:
  839.  
  840.                 P: function GPRDPAL(Palette: Integer): Integer;
  841.  
  842.                 C: int GPRDPAL(Palette)
  843.                      int Palette;
  844.  
  845.         DESCRIPTION:
  846.  
  847.                 Read the setting of the specified palette register.  If
  848.             an EGA save area has not be defined then this function will
  849.             return -1 instead of a palette color.  Use the program
  850.             'KCSETPAL' to define a save area.
  851.  
  852.         RETURN:
  853.  
  854.                 Palette color or -1 if can be found. (run KCSETPAL).
  855.  
  856.         EXAMPLE:
  857.  
  858.             C: current_color = GPRDPAL(5)  /* Read palette 5  */
  859.  
  860.                if (current_color == -1)    /* Recover on null */
  861.                  current_color = 5;
  862.  
  863.         SEE ALSO:
  864.  
  865.             GPPAL.
  866.  
  867.  
  868.                                                         DATE:   02/03/86
  869.                                                         SYSTEM: KC-TPEGA
  870.  
  871.  
  872.  
  873.         NAME:
  874.  
  875.                 GPPLOT -- Plot a pixel at the given corrdinate
  876.  
  877.         SYNOPSIS:
  878.  
  879.                 P: procedure GPPLOT(x,y: Integer);
  880.  
  881.                 C: void GPPLOT(x,y)
  882.                      int x,y;
  883.  
  884.         DESCRIPTION:
  885.  
  886.                 Plot a point at the given coordinates using the current
  887.             color and merge values.  The upper left corner is (0,0) on
  888.             the graphic screen.  The specifed (X,Y) coordinate becomes
  889.             the new current position (CP).  Automatic clipping is
  890.             preformed.
  891.  
  892.         RETURN:
  893.  
  894.             GDC_FLG = 0 if point is in the current viewport.
  895.                       2 if point out of current viewport (not plotted)
  896.  
  897.         EXAMPLE:
  898.  
  899.             P: GPCOLOR(Green);          { Set color to Green            }
  900.                GPPLOT(5,5);             { Plot a Green pixels at (5,5)  }
  901.                GPLINE(9,9);             { Draw line from (5,5) to (9,9) }
  902.  
  903.         SEE ALSO:
  904.  
  905.             GPCOLOR, GPMERGE and GPMOVE.
  906.  
  907.  
  908.                                                         DATE:   02/03/86
  909.                                                         SYSTEM: KC-TPEGA
  910.  
  911.  
  912.  
  913.         NAME:
  914.  
  915.                 GPRDDOT -- Read the pixel at the given corrdinate
  916.  
  917.         SYNOPSIS:
  918.  
  919.                 P: function GPRDDOT(x,y: Integer): Integer;
  920.  
  921.                 C: int GPRDDOT(x,y)
  922.                      int x,y;
  923.  
  924.         DESCRIPTION:
  925.  
  926.                 Read the pixel at the given coordinates.
  927.  
  928.         CAUTIONS:
  929.  
  930.                 The global variable GDMEMORY is used to determine the
  931.             number of planes to read (two for 64k, and four 128k+)
  932.  
  933.         EXAMPLE:
  934.  
  935.             P: color: Integer;
  936.  
  937.                color := GPRDDOT(5,4)    { Read color at (5,4)           }
  938.  
  939.         SEE ALSO:
  940.  
  941.             GPPARMS.
  942.  
  943.  
  944.                                                         DATE:   02/03/86
  945.                                                         SYSTEM: KC-TPEGA
  946.  
  947.  
  948.  
  949.         NAME:
  950.  
  951.                 GPMOVE -- Move graphic cursor to new position
  952.  
  953.         SYNOPSIS:
  954.  
  955.                 P: procedure GPMOVE(x,y: Integer);
  956.  
  957.                 C: void GPMOVE(x,y)
  958.                      int x,y;
  959.  
  960.         DESCRIPTION:
  961.  
  962.                 Set the graphic cursor to the specified position to be
  963.             the new current position (CP).
  964.  
  965.         EXAMPLE:
  966.  
  967.             P: GPCOLOR(Green);          { Set color to Green            }
  968.                GPMOVE(5,5);             { Set CP to (5,5)               }
  969.                GPLINE(9,9);             { Draw line from (5,5) to (9,9) }
  970.  
  971.         SEE ALSO:
  972.  
  973.             GPPLOT and GPLINE.
  974.  
  975.  
  976.                                                         DATE:   02/03/86
  977.                                                         SYSTEM: KC-TPEGA
  978.  
  979.  
  980.  
  981.         NAME:
  982.  
  983.                 GPLINE -- Draw a line from CP to (X,Y)
  984.  
  985.         SYNOPSIS:
  986.  
  987.                 P: procedure GPLINE(x,y: Integer);
  988.  
  989.                 C: void GPLINE(x,y)
  990.                      int x,y;
  991.  
  992.         DESCRIPTION:
  993.  
  994.                 Draw a line from the current position (CP) to the given
  995.             coordinate using the current merge, color or line style values.
  996.             Automatic line clipping is performed in the current viewport.
  997.  
  998.         RETURN:
  999.  
  1000.             GDC_FLG = 0 if line is in the current viewport.
  1001.                       1 if line was clipped, but still plotted (part of)
  1002.                       2 if line out of current viewport (not plotted)
  1003.  
  1004.         EXAMPLE:
  1005.  
  1006.             P: GPCOLOR(Green);          { Set color to Green            }
  1007.                GPMOVE(5,5);             { Set CP to (5,5)               }
  1008.                GPLINE(9,9);             { Draw line from (5,5) to (9,9) }
  1009.  
  1010.         SEE ALSO:
  1011.  
  1012.             GPCOLOR, GPMERGE, GPSTYLE and GPMOVE.
  1013.  
  1014.  
  1015.                                                         DATE:   02/03/86
  1016.                                                         SYSTEM: KC-TPEGA
  1017.  
  1018.  
  1019.  
  1020.         NAME:
  1021.  
  1022.                 GPPOLY -- Connect an array of points
  1023.  
  1024.         SYNOPSIS:
  1025.  
  1026.                 P: procedure GPPOLY(var points; N: Integer);
  1027.  
  1028.                 C: void GPLINE(points,n)
  1029.                      int points[]
  1030.                      int n;
  1031.  
  1032.         DESCRIPTION:
  1033.  
  1034.                 Starting from the CP, connect each point with a line.
  1035.  
  1036.         EXAMPLE:
  1037.  
  1038.             P: GPCOLOR(Green);          { Set color to Green            }
  1039.                GPMOVE(5,5);             { Set CP to (5,5)               }
  1040.                GPPOLY(car,50);          { Draw a car                    }
  1041.  
  1042.         SEE ALSO:
  1043.  
  1044.             GPLINE.
  1045.  
  1046.  
  1047.                                                         DATE:   02/03/86
  1048.                                                         SYSTEM: KC-TPEGA
  1049.  
  1050.  
  1051.  
  1052.         NAME:
  1053.  
  1054.                 GPRECT -- Draw a rectangle
  1055.  
  1056.         SYNOPSIS:
  1057.  
  1058.                 P: procedure GPRECT(x,y: Integer);
  1059.  
  1060.                 C: void GPRECT(x,y)
  1061.                      int x,y;
  1062.  
  1063.         DESCRIPTION:
  1064.  
  1065.                 Draws a rectangle with CP and given x,y coordinates.
  1066.             The X,Y coordinates becomes the new CP.
  1067.  
  1068.         EXAMPLE:
  1069.  
  1070.             P: GPCOLOR(Green);          { Set color to Green            }
  1071.                GPMOVE(5,5);             { Set CP to (5,5)               }
  1072.                GPRECT(10,10);           { Draw a rectangle              }
  1073.  
  1074.         SEE ALSO:
  1075.  
  1076.             CPCOLOR, GPMOVE and GPLINE.
  1077.  
  1078.  
  1079.                                                         DATE:   02/03/86
  1080.                                                         SYSTEM: KC-TPEGA
  1081.  
  1082.  
  1083.  
  1084.         NAME:
  1085.  
  1086.                 GPCIR -- Draw a circle around the CP
  1087.  
  1088.         SYNOPSIS:
  1089.  
  1090.                 P: procedure GPCIR(radius: Integer);
  1091.  
  1092.                 C: void GPCIR(radius)
  1093.                      int radius;
  1094.  
  1095.         DESCRIPTION:
  1096.  
  1097.                 Starting from the CP, draw a circle with the given radius
  1098.             around it clipping in the current viewport.
  1099.  
  1100.         RETURN:
  1101.  
  1102.             GDC_FLG = 0 if circle is in the current viewport.
  1103.                       1 if circle was clipped, but still plotted (part of)
  1104.                       2 if circle out of current viewport (not plotted)
  1105.  
  1106.         CAUTIONS:
  1107.  
  1108.             The current line style can not be used only the color value.
  1109.  
  1110.         EXAMPLE:
  1111.  
  1112.             P: GPCOLOR(Green);          { Set color to Green            }
  1113.                GPMOVE(100,100);         { Set CP to (5,5)               }
  1114.                GPCIR(50);               { Draw a circle                 }
  1115.  
  1116.         SEE ALSO:
  1117.  
  1118.             GPMOVE.
  1119.  
  1120.  
  1121.                                                         DATE:   02/03/86
  1122.                                                         SYSTEM: KC-TPEGA
  1123.  
  1124.  
  1125.  
  1126.         NAME:
  1127.  
  1128.                 GPWTROW -- Write a row of pixels
  1129.  
  1130.         SYNOPSIS:
  1131.  
  1132.                 P: procedure GPWTROW(var Pixels: Byte; N: Integer);
  1133.  
  1134.                 C: void GPWTROW(Pixels,N)
  1135.                      unsigned char Pixels[];
  1136.                      int N;
  1137.  
  1138.         DESCRIPTION:
  1139.  
  1140.                 Write a row of pixels from the current position (CP), N
  1141.             pixels wide using the specifed byte array of colors.
  1142.  
  1143.         CAUTIONS:
  1144.  
  1145.                 If the row of pixels leave the edge of the screen, the
  1146.             rest will appear on the other side. (Can be a plus).
  1147.  
  1148.         EXAMPLE:
  1149.  
  1150.             P: Pixels: array [0.63] of byte;
  1151.  
  1152.                GPMOVE(5,5);
  1153.                GPWTROW(Pixels,64);
  1154.  
  1155.         SEE ALSO:
  1156.  
  1157.             GPMOVE, and GPWTCOL.
  1158.  
  1159.  
  1160.                                                         DATE:   02/03/86
  1161.                                                         SYSTEM: KC-TPEGA
  1162.  
  1163.  
  1164.  
  1165.         NAME:
  1166.  
  1167.                 GPWTCOL -- Write a column of pixels
  1168.  
  1169.         SYNOPSIS:
  1170.  
  1171.                 P: procedure GPWTCOL(var Pixels: Byte; N: Integer);
  1172.  
  1173.                 C: void GPWTCOL(Pixels,N)
  1174.                      unsigned char Pixels[];
  1175.                      int N;
  1176.  
  1177.         DESCRIPTION:
  1178.  
  1179.                 Write a column of pixels from the current position (CP),
  1180.             N pixels high using the specifed byte array of colors.
  1181.  
  1182.         CAUTIONS:
  1183.  
  1184.                 If the column of pixels leave the edge of the screen,
  1185.             the rest will appear on the other side. (Can be a plus).
  1186.  
  1187.         EXAMPLE:
  1188.  
  1189.             P: Pixels: array [0.63] of byte;
  1190.  
  1191.                GPMOVE(5,5);
  1192.                GPWTROW(Pixels,64);
  1193.  
  1194.         SEE ALSO:
  1195.  
  1196.             GPMOVE, and GPWTROW.
  1197.  
  1198.  
  1199.                                                         DATE:   02/03/86
  1200.                                                         SYSTEM: KC-TPEGA
  1201.  
  1202.  
  1203.  
  1204.         NAME:
  1205.  
  1206.                 GPBOX -- Fills in specified box with current color
  1207.  
  1208.         SYNOPSIS:
  1209.  
  1210.                 P: procedure GPBOX(x,y: Integer);
  1211.  
  1212.                 C: void GPBOX(x,y)
  1213.                      int x,y;
  1214.  
  1215.         DESCRIPTION:
  1216.  
  1217.                 Fills the specified area (box shaped) using the current
  1218.             color and merge value.  Normally used to clear the screen or
  1219.             reverse an area using merge XOR setting.  The CP and the
  1220.             specified X,Y coordinates are used as the corners of the box.
  1221.  
  1222.         RETURN:
  1223.  
  1224.             GDC_FLG = 0 if box is in the current viewport.
  1225.                       1 if box was clipped, but still plotted (part of)
  1226.                       2 if box out of current viewport (not plotted)
  1227.  
  1228.         EXAMPLE:
  1229.  
  1230.             P: GPCOLOR(Black);
  1231.                GPMOVE(0,0);
  1232.                GPBOX(GDMAXCOL,GDMAXROW); { Clear Screen }
  1233.  
  1234.             C: GPCOLOR(GDMAXCLR)            /* Load 0x0F to reverse bits */
  1235.                GPMERGE(3);                  /* Set merge mode to XOR     */
  1236.                GPMOVE(50,50);
  1237.                GPBOX(100,100);              /* Reverse bits in this box  */
  1238.  
  1239.         SEE ALSO:
  1240.  
  1241.             GPCOLOR, GPMERGE.
  1242.  
  1243.  
  1244.                                                         DATE:   02/03/86
  1245.                                                         SYSTEM: KC-TPEGA
  1246.  
  1247.  
  1248.  
  1249.         NAME:
  1250.  
  1251.                 GPBALL -- Fills in specified circle with color/shade
  1252.  
  1253.         SYNOPSIS:
  1254.  
  1255.                 P: procedure GPBALL(Radius: Integer);
  1256.  
  1257.                 C: void GPBALL(Radius)
  1258.                      int Radius;
  1259.  
  1260.         DESCRIPTION:
  1261.  
  1262.                 Fills the specified area (ball shaped) using the current
  1263.             color and merge value.
  1264.  
  1265.         RETURN:
  1266.  
  1267.             GDC_FLG = 0 if ball is in the current viewport.
  1268.                       1 if ball was clipped, but still plotted (part of)
  1269.                       2 if ball out of current viewport (not plotted)
  1270.  
  1271.         EXAMPLE:
  1272.  
  1273.             P: GPCOLOR(Blue);
  1274.                GPMOVE(100,100)
  1275.                GPBALL(50);
  1276.  
  1277.         SEE ALSO:
  1278.  
  1279.             GPCIR, GPCOLOR and GPSHADE.
  1280.  
  1281.  
  1282.                                                         DATE:   02/03/86
  1283.                                                         SYSTEM: KC-TPEGA
  1284.  
  1285.  
  1286.  
  1287.         NAME:
  1288.  
  1289.                 GPSCROLL -- Scroll the current viewport
  1290.  
  1291.         SYNOPSIS:
  1292.  
  1293.                 P: procedure GPSCROLL(Dir, N: Integer);
  1294.  
  1295.                 C: void GPSCROLL(Dir, N)
  1296.                      int  Dir, N;
  1297.  
  1298.         DESCRIPTION:
  1299.  
  1300.                 Scroll the viewport in the specified direction by N
  1301.             lines.  The viewport to be scrolled must be a byte boundary.
  1302.             (x coordinate only).  The direction code is defined as:
  1303.  
  1304.                             0    4   12
  1305.                             1    5   13
  1306.                             3    7   15
  1307.  
  1308.         EXAMPLE:
  1309.  
  1310.             P: GPVIEWPORT(48,50,95,100);
  1311.  
  1312.                GPSCROLL(4,1);   { Scroll the viewport up by one line }
  1313.  
  1314.         SEE ALSO:
  1315.  
  1316.             GPVIEWPORT.
  1317.  
  1318.  
  1319.                                                         DATE:   02/03/86
  1320.                                                         SYSTEM: KC-TPEGA
  1321.  
  1322.  
  1323.  
  1324.         NAME:
  1325.  
  1326.                 GPVIEWPORT -- Specified an area to plot graphic commands
  1327.  
  1328.         SYNOPSIS:
  1329.  
  1330.                 P: procedure GPVIEWPORT(x1,y1,x2,y2: Integer);
  1331.  
  1332.                 C: void GPVIEWPORT(x1,y1,x2,y2)
  1333.                      int x1,y1; /* lower left corner of viewport  */
  1334.                      int x2,y2; /* upper right corner of viewport */
  1335.  
  1336.         DESCRIPTION:
  1337.  
  1338.                 Specify an area on the screen to perform graphic function.
  1339.             The viewport parameters are in Graphic Device Units (GDU). The
  1340.             IBM's Enhance Graphic Adapter is 640x350 GDUs.  The 'GPINIT'
  1341.             function will perform viewport(0,0,639,349).  This function is
  1342.             simular to the Turbo's GraphWindow or BASIC's Viewport.  The
  1343.             basic graphic primitives are clipped using the current viewport.
  1344.  
  1345.         EXAMPLE:
  1346.  
  1347.             GPVIEWPORT(50,50,600,300); { Define viewport }
  1348.                                                  |
  1349.                 .-----------------------.        |
  1350.                 |(0,0)                  |        |
  1351.                 |   .---------------.   |        |
  1352.                 |   |(50,50)        |   |        |
  1353.                 |   |               <------------+
  1354.                 |   |               |   |
  1355.                 |   |      (600,300)|   |
  1356.                 |   `---------------'   |<--- Default Viewport
  1357.                 |              (639,349)|
  1358.                 `-----------------------'
  1359.  
  1360.         SEE ALSO:
  1361.  
  1362.             GPPLOT, GPLINE, GPCIR and GPWINDOW.
  1363.  
  1364.  
  1365.                                                         DATE:   02/03/86
  1366.                                                         SYSTEM: KC-TPEGA
  1367.  
  1368.  
  1369.  
  1370.         NAME:
  1371.  
  1372.                 GPWINDOW -- specified a set coordinates
  1373.  
  1374.         SYNOPSIS:
  1375.  
  1376.                 procedure GPWindow(x1,y1,x2,y2: Integer);
  1377.  
  1378.                 int  x1,y1;     lower left corner of window
  1379.                 int  x2,y2;     upper right corner of window
  1380.  
  1381.         DESCRIPTION:
  1382.  
  1383.                 Specify a new set of coordinates for the current viewport.
  1384.             The coordinates are signed integers (-32768 <--> +32767).  It
  1385.             is simular to the BASIC's Window function.  The graphic
  1386.             primitives GPSCALE, GPCLIP1 and GPCLIP2 can be used for scaling
  1387.             and clipping using the current window.  See the file WORLD.P
  1388.             for function that support the world coordinate system.
  1389.  
  1390.         RETURNS:
  1391.  
  1392.             None.
  1393.  
  1394.         CAUTIONS:
  1395.  
  1396.                 If the viewport and window coordinates are different then
  1397.             an extra scaling process is perform on graphic functions.  No
  1398.             checks are performed on input parameters.
  1399.  
  1400.         EXAMPLE:
  1401.  
  1402.             GPViewport(50,50,600,300);    { Define viewport }
  1403.             GPWindow(-100,-100,100,100); { Define a new set of corrdinates }
  1404.                                                  |
  1405.                 .-----------------------.        |
  1406.                 |(0,0)                  |        |
  1407.                 |   .---------------.   |        |
  1408.                 |   |(-100,-100)    |   |        |
  1409.                 |   |               <------------+
  1410.                 |   |               |   |
  1411.                 |   |      (100,100)|   |
  1412.                 |   `---------------'   |<--- Default Viewport
  1413.                 |              (639,349)|
  1414.                 `-----------------------'
  1415.  
  1416.         SEE ALSO:
  1417.  
  1418.             GPVIEWPORT, and GPSCALE.
  1419.  
  1420.                                                         DATE:   02/03/86
  1421.                                                         SYSTEM: KC-TPEGA
  1422.  
  1423.  
  1424.  
  1425.         NAME:
  1426.  
  1427.                 GPCLIP1 -- Clip a point within the current viewport
  1428.  
  1429.         SYNOPSIS:
  1430.  
  1431.                 P: function GPCLIP1(var x,y: Integer): Integer;
  1432.  
  1433.                 C: int GPCLIP1(x,y)
  1434.                      int x,y;
  1435.  
  1436.         DESCRIPTION:
  1437.  
  1438.                 Perform point clipping on the specifed point and return
  1439.             a zero (0) if the point is in the current viewport, else non-
  1440.             zero response.
  1441.  
  1442.         RETURN:
  1443.  
  1444.                 Zero, if inside viewport, else non-zero if outside.
  1445.  
  1446.         EXAMPLE:
  1447.  
  1448.             C: GPVIEWPORT(50,50,100,100);       /* Set current viewport */
  1449.  
  1450.                void PtAbs(x,y)                  /* Define WORLD routine */
  1451.                  int x,y;
  1452.                {
  1453.                  if (GPCLIP1(x,y) == 0)         /* Do boundary check    */
  1454.                    {
  1455.                    GPSCALE(x,y);                /* If inside viewport
  1456.                    GPPLOT(x,y);                      scale and plot     */
  1457.                    }
  1458.                }
  1459.  
  1460.         SEE ALSO:
  1461.  
  1462.             GPVIEWPORT, GPCLIP2, and GPSCALE.
  1463.  
  1464.  
  1465.                                                         DATE:   02/03/86
  1466.                                                         SYSTEM: KC-TPEGA
  1467.  
  1468.  
  1469.  
  1470.         NAME:
  1471.  
  1472.                 GPCLIP2 -- Clip a line within the current viewport
  1473.  
  1474.         SYNOPSIS:
  1475.  
  1476.                 P: function GPCLIP2(var x1,y1,x2,y2: Integer): Integer;
  1477.  
  1478.                 C: int GPCLIP2(x1,y1,x2,y2)
  1479.                      int *x1,*y1,*x2,*y2;
  1480.  
  1481.         DESCRIPTION:
  1482.  
  1483.                 Perform point clipping on the specifed line and return
  1484.             a zero (0) if the line is completly in the current viewport
  1485.             or an one (1) if line clipping was performed or two (2) if
  1486.             totally outside of the viewport.
  1487.  
  1488.         RETURN:
  1489.  
  1490.                 Returns zero (0) is the line is completly in the viewport
  1491.             (no clipping performed).  One (1) if the line was clip and the
  1492.             x1,y1,x2,y2 value now contain the clipped line.  Two (2) if
  1493.             the line is outside of the viewport.
  1494.  
  1495.         EXAMPLE:
  1496.  
  1497.             C: GPVIEWPORT(50,50,100,100);       /* Set current viewport */
  1498.  
  1499.                if (GPCLIP2(x1,y1,x2,y2) != 2)   /* Do boundary check    */
  1500.                  {
  1501.                  GPSCALE(x1,y1);                /* If inside viewport
  1502.                  GPMOVE(x1,y1);                      scale and draw     */
  1503.                  GPSCALE(x2,y2);
  1504.                  GPLINE(x2,y2);
  1505.                  }
  1506.                }
  1507.  
  1508.         SEE ALSO:
  1509.  
  1510.             GPVIEWPORT, GPCLIP1, and GPSCALE.
  1511.  
  1512.  
  1513.                                                         DATE:   02/03/86
  1514.                                                         SYSTEM: KC-TPEGA
  1515.  
  1516.  
  1517.  
  1518.         NAME:
  1519.  
  1520.                 GPSCALE -- Scale a world coordinate to viewport
  1521.  
  1522.         SYNOPSIS:
  1523.  
  1524.                 P: procedure GPSCALE(var x,y: Integer);
  1525.  
  1526.                 C: void GPSCALE(x,y)
  1527.                      int *x,*y;
  1528.  
  1529.         DESCRIPTION:
  1530.  
  1531.                 Scale the specifed point from world coordinates to the
  1532.             Device coordinates in the current viewport.
  1533.  
  1534.         RETURN:
  1535.  
  1536.                 Changes the X,Y coordinate to real (hardware) coordinates.
  1537.  
  1538.         EXAMPLE:
  1539.  
  1540.             C: GPWINDOW(0,0,1000,1000);         /* Set world coordinates */
  1541.                GPVIEWPORT(50,50,100,100);       /* Set current viewport  */
  1542.  
  1543.                if (GPCLIP2(x1,y1,x2,y2) != 2)   /* Do boundary check     */
  1544.                  {
  1545.                  GPSCALE(x1,y1);                /* If inside viewport
  1546.                  GPMOVE(x1,y1);                      scale and draw      */
  1547.                  GPSCALE(x2,y2);
  1548.                  GPLINE(x2,y2);
  1549.                  }
  1550.                }
  1551.  
  1552.         SEE ALSO:
  1553.  
  1554.             GPWINDOW, GPVIEWPORT, GPCLIP1, and GPGLIP2.
  1555.  
  1556.  
  1557.                                                         DATE:   02/03/86
  1558.                                                         SYSTEM: KC-TPEGA
  1559.  
  1560.  
  1561.  
  1562.         NAME:
  1563.  
  1564.                 GPFILL -- Fill the specified area with color/shading
  1565.  
  1566.         SYNOPSIS:
  1567.  
  1568.                 P: procedure GPFILL(Border_Color: Integer);
  1569.  
  1570.                 C: void GPFILL(Border_Color)
  1571.                      unsigned integer Border_Color;
  1572.  
  1573.         DESCRIPTION:
  1574.  
  1575.                 Fill in an area starting at the CP to the border given.
  1576.             The current color or current shading will be used depending
  1577.             on the setting of the GDS_FLG variable.  The routine is for
  1578.             simple areas only, which makes it much faster than GPFLOOD.
  1579.             If the area is too complex for GPFILL, parts of the area will
  1580.             not be filled in (but it will work).  GPFILL will not fill
  1581.             pass the current viewport setting.
  1582.  
  1583.         CAUTIONS:
  1584.  
  1585.             Although any dimension from 1 to 255 can be used, the current
  1586.             version of GPFILL and GPFLOOD only works correctly with shade
  1587.             of dimensions of 1,2,4 or 8 (x and y can be different).  This
  1588.             restriction will be removed in the future.
  1589.  
  1590.         EXAMPLE:
  1591.  
  1592.             C: unsigned char Shade[] =     /* Set fill shade to GBGB  */
  1593.                  {2,2,Green,Blue,Blue,Green};    /* 2 by 2 array */
  1594.  
  1595.                GPSHADE(Shade);             /* Define the shading      */
  1596.  
  1597.                GPMOVE(X1,Y1);
  1598.                GPFILL(color);              /* Flood area with border
  1599.                                               defined by color        */
  1600.  
  1601.         SEE ALSO:
  1602.  
  1603.             GPCOLOR, GPSHADE, GPFLOOD and GPVIEWPORT.
  1604.  
  1605.  
  1606.                                                         DATE:   02/03/86
  1607.                                                         SYSTEM: KC-TPEGA
  1608.  
  1609.  
  1610.  
  1611.         NAME:
  1612.  
  1613.                 GPFLOOD -- Flood the specified area with color/shading
  1614.  
  1615.         SYNOPSIS:
  1616.  
  1617.                 P: procedure GPFLOOD(Border_Color: Integer);
  1618.  
  1619.                 C: void GPFLOOD(Border_Color)
  1620.                      unsigned integer Border_Color;
  1621.  
  1622.         DESCRIPTION:
  1623.  
  1624.                 Flood in an area starting at the CP to the border given.
  1625.             The current color or current shading will be used depending
  1626.             on the setting of the GDS_FLG variable.  The routine is for
  1627.             all complex areas, which makes it much slower than GPFILL.
  1628.             If the area is simple, try GPFILL, if it does not fill it all
  1629.             then go back to GPFLOOD.  GPFLOOD will not flood pass the
  1630.             current viewport setting.
  1631.  
  1632.         CAUTIONS:
  1633.  
  1634.             Although any dimension from 1 to 255 can be used, the current
  1635.             version of GPFLOOD only works correctly with shade of
  1636.             dimensions of 1,2,4 or 8 (x and y can be different).  This
  1637.             restriction will be removed in the future.
  1638.  
  1639.         EXAMPLE:
  1640.  
  1641.             C: unsigned char Shade[] =     /* Set fill shade to GBGB  */
  1642.                  {2,2,Green,Blue,Blue,Green};    /* 2 by 2 array */
  1643.  
  1644.                GPSHADE(Shade);             /* Define the shading      */
  1645.  
  1646.                GPMOVE(X1,Y1);
  1647.                GPFLOOD(color);             /* Flood area with border
  1648.                                               defined by color        */
  1649.  
  1650.         SEE ALSO:
  1651.  
  1652.             GPCOLOR, GPSHADE, GPFILL, and GPVIEWPORT.
  1653.  
  1654.  
  1655.